<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" isELIgnored="false"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Login - manage - www.adpython.com</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>

<link rel="shortcut icon" href="/images/favicon.ico" />
<link href="/css/manage.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/js/tinymce/tiny_mce.js"></script>
<script type="text/javascript">
	tinyMCE.init({
		// General options
		mode : "textareas",
		theme : "advanced",
		plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",

		// Theme options
		theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
		theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
		theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
		theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : false,

		// Example content CSS (should be your site CSS)
		content_css : "/js/tinymce/css/content.css",

		// Drop lists for link/image/media/template dialogs
		template_external_list_url : "/js/tinymce/lists/template_list.js",
		external_link_list_url : "/js/tinymce/lists/link_list.js",
		external_image_list_url : "/js/tinymce/lists/image_list.js",
		media_external_list_url : "/js/tinymce/lists/media_list.js",

		// Replace values for the template plugin
		template_replace_values : {
			username : "Some User",
			staffid : "991234"
		}
	});

	function checkSubmit(){
		var title=document.getElementById('title').value;
		if(title==''){
			alert("Article Title can't be null");
			return false;
		}
		var channelId=document.getElementById('channelId').value;
		if(channelId==''){
			alert("You must choose a channel");
			return false;
		}
		document.getElementById('f').submit();
	}
	
</script>
</head>
<body>
	<%@ include file="header.jsp" %>
	<div class="body">
		<div class="right">
			<div class="wrapper">
				<form method="post" action="/manage.htm?method=submitArticle" id="f" name="f" style="width: 100%;">
					<input type="hidden" id="articleId" name="articleId" value="${article.id}"/>
					<div class="right_content">
						<table id="editor_table" cellspacing="10px;">
							<tr><td><span class="left">Article Title:</span></td><td><span class="right"><input type="text" id="title" name="title" value="${article.title}" /></span></td></tr>
							<tr><td><span class="left">Choose a channel:</span></td><td><span class="right">
								<select id="channelId" name="channelId">
									<c:forEach items="${channelList}" var="channel">
										<option <c:if test="${article.channelId eq channel.id}">selected</c:if> value="${channel.id}">${channel.title}</option>
									</c:forEach>
								</select></span>
							</td></tr>
						</table>
					</div>
					<div class="right_title"><span>Adpython Editor.</span></div>
					<div class="right_content">
						<div style="width: 100%;">
							<div style="width: 100%;">
								<textarea id="content" name="content" rows="15" cols="80" style="width: 100%;height: 300px;">${article.content.value}</textarea>
							</div>
					
							<!-- Some integration calls -->
							<!--<a href="javascript:;" onmousedown="tinyMCE.get('elm1').show();">[Show]</a>
							<a href="javascript:;" onmousedown="tinyMCE.get('elm1').hide();">[Hide]</a>
							<a href="javascript:;" onmousedown="tinyMCE.get('elm1').execCommand('Bold');">[Bold]</a>
							<a href="javascript:;" onmousedown="alert(tinyMCE.get('elm1').getContent());">[Get contents]</a>
							<a href="javascript:;" onmousedown="alert(tinyMCE.get('elm1').selection.getContent());">[Get selected HTML]</a>
							<a href="javascript:;" onmousedown="alert(tinyMCE.get('elm1').selection.getContent({format : 'text'}));">[Get selected text]</a>
							<a href="javascript:;" onmousedown="alert(tinyMCE.get('elm1').selection.getNode().nodeName);">[Get selected element]</a>
							<a href="javascript:;" onmousedown="tinyMCE.execCommand('mceInsertContent',false,'<b>Hello world!!</b>');">[Insert HTML]</a>
							<a href="javascript:;" onmousedown="tinyMCE.execCommand('mceReplaceContent',false,'<b>{$selection}</b>');">[Replace selection]</a>
							-->
							<br />
							<input type="button" name="save" onclick="checkSubmit();" value="Submit" />
							<input type="reset" name="reset" value="Reset" />
						</div>
					</div>
				</form>
			</div>
		</div>
		<%@ include file="left.jsp" %>
	</div>
	<%@ include file="footer.jsp" %>
</body>
</html>